package com.example.myaidllearing;

import android.app.Service;
import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;
import android.os.RemoteException;

import androidx.annotation.Nullable;

import java.util.Random;

/**
 * @author tgw
 * @date 2021/1/20
 */
public class MyTransService extends Service {

    private MyBinder myBinder;

    public MyTransService() {
        myBinder = new MyBinder();
    }

    @Nullable
    @Override
    public IBinder onBind(Intent intent) {
        return myBinder;
    }

    @Override
    public boolean onUnbind(Intent intent) {
        return super.onUnbind(intent);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
    }
    

    class MyBinder extends IMyAidlInterface.Stub {
        private String contnet;
        @Override
        public void setName(String contnet) throws RemoteException {
            this.contnet = contnet;
        }
        @Override
        public String getName() throws RemoteException {
            return contnet;
        }

        public MyTransService getService(){
            return MyTransService.this;
        }
    }


}
